'use strict'


function getblogList(keyword) {
    return new Promise(function (resolve, reject) {
        $.get(`${baseUrl}/blog?keyword=` + keyword, (data) => {
            resolve(data);
        })

    })
}
function addblog(obj) {
    return new Promise(function (resolve, reject) {
        $.post(`${baseUrl}/blog`, obj, (data) => {
            resolve(data);
        })
    })
}

function updateblog(id, obj) {
    return new Promise(function (resolve, reject) {
        $.ajax({
            url: `${baseUrl}/blog/${id}`,
            type: "PUT",
            data: obj,
            success: function (data) {
                resolve(data);
            }
        })
    })
}

function getbyid(id){
    return new Promise(function (resolve,reject){
        $.get(`${baseUrl}/blog/${id}`,data=>{
            resolve(data)
        })
    })
}

function  daleteblog(id){
    return new Promise(function (resolve,reject){
        $.ajax({
            url:`${baseUrl}/blog/${id}`,
            type:"delete",
            success: function (data) {
                resolve(data);
            }
        })
    })
}